﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="EditService.aspx.cs" Inherits="EditService" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  <div>
  <table width="100%">
  <tr>
    <td class="header">Edit Service</td>
  </tr>
  </table>
  <br />
      <asp:FormView ID="frmEditService" runat="server" BackColor="#DEBA84" 
          BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
          CellSpacing="2" GridLines="Both" 
          onitemcommand="frmEditService_ItemCommand" 
          DataSourceID="ObjectDataSourceEditService" Width="500px">
      <ItemTemplate><table class="table01" width="100%">
        <tr>
            <td width="20%">
                <b>Service Name</b>
            </td>
            <td width="40%">
                <asp:TextBox ID="txtServiceName" runat="server" Width="300px" 
                     Text='<%# Eval("ServiceName") %>' Enabled="false"></asp:TextBox>
               
            </td>
        </tr>
        <tr>
            <td width="20%">
                <b>Service Image</b>
            </td>
            <td width="40%">
                <asp:Image ID="ImageService" runat="server" Height="100px" ImageUrl='<%# Eval("ServiceImage", "~/Images/Service/{0}") %>'
                        Width="100px" Enabled="false" />
            </td>
        </tr>
        <tr>
            <td width="20%">
                <b>Service Description</b>
            </td>
            <td width="40%">
                <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Height="100" 
                    Width="300" Text='<%#Eval("Description") %>' Enabled="false"></asp:TextBox>
            </td>
        </tr></table>
          <asp:Button ID="cmdEdit" runat="server" Text="Edit" ToolTip="Click here to edit information service"  CommandName="Edit"/>
        </ItemTemplate>
          <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
          <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
      <EditItemTemplate>  <table class="table01" width="100%">
        <tr>
            <td width="20%">
                <b>Service Name</b>
            </td>
            <td width="40%">
                <asp:TextBox ID="txtServiceName" runat="server" Width="300px" 
                    ValidationGroup="AddService" Text='<%# Bind("ServiceName") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="valServiceName" runat="server" ErrorMessage="Please enter name of service"
                    ControlToValidate="txtServiceName" ValidationGroup="AddService">*</asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td width="20%">
                <b>Service Image</b>
            </td>
            <td width="40%">
                <asp:FileUpload ID="ImageServiceUpload" runat="server" Width="200px" 
                    ValidationGroup="AddService" 
                    ToolTip='<%# Eval("ServiceImage") %>'></asp:FileUpload>
               <%-- <asp:RequiredFieldValidator ID="valUploadServiceImage" runat="server" ErrorMessage="Please choose Image of service"
                    ControlToValidate="ImageServiceUpload" ValidationGroup="AddService">*</asp:RequiredFieldValidator>--%>
                <asp:RegularExpressionValidator ValidationGroup="AddService" ID="RegularExpressionImage"
                    runat="server" ControlToValidate="ImageServiceUpload" ValidationExpression="(.*?)\.(jpg|jpeg|png|gif)$"
                    ErrorMessage="Image is not valid" Text="*"></asp:RegularExpressionValidator>
                <asp:Label ID="lblImageUpload" runat="server" Text='<%# Eval("ServiceImage") %>'></asp:Label>
            </td>
        </tr>
        <tr>
            <td width="20%">
                <b>Service Description</b>
            </td>
            <td width="40%">
                <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Height="100" ValidationGroup="AddService"
                    Width="300" Text='<%#Bind("Description") %>'></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="btnReset" runat="server" Text="Cancel" CausesValidation="false"  CommandName="Cancel"/>
                <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="AddService"  CommandName="Update"/>
            </td>
        </tr>
        
        <tr>
            <td colspan="2">
               <asp:ValidationSummary ID="ValidationSummary1" runat="server"  ValidationGroup="AddService"/>
        </tr>
        
    </table></EditItemTemplate>
          <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
          <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
          <EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
      </asp:FormView>
      <asp:ObjectDataSource ID="ObjectDataSourceEditService" runat="server" 
          OldValuesParameterFormatString="original_{0}" SelectMethod="SelectedService" 
          TypeName="DALService" UpdateMethod="UpdateService">
          <UpdateParameters>
              <asp:Parameter Name="ServiceName" Type="String" />
              <asp:Parameter Name="ServiceImage" Type="String" />
              <asp:Parameter Name="Description" Type="String" />
              <asp:Parameter Name="ServiceID" Type="String" />
          </UpdateParameters>
          <SelectParameters>
              <asp:QueryStringParameter Name="ServiceID" QueryStringField="id" 
                  Type="String" />
          </SelectParameters>
      </asp:ObjectDataSource>
      <asp:Label ID="lblMessage" runat="server"></asp:Label>
  <br />
  
    </div>
</asp:Content>

